implemented garbage collector- needs prove