added pre-allocation