refactor allocator constructor