cleaned for master thesis
garbage collection implemented