Tentatively solved memory compaction, also removed some commented code