Cleanup, compacting and optimization part.1.5