first version of garbage collector working