Implemented garbage collection