working on allocatePage