implemented freeing, fixed bugs in clone, changed stack location