Implemented the garbage collector