Fixed uncollectable cycle and removed old code