added basic garbage collection