started work on garbage collector

found some memory leaks