alloc & free working. walkthrough algo still needs to be optimized