refactoring on allocator