Added setCapacity function to pre-size the storage