updated version
improved memory allocator