massiva optimization and cleanup