cleaned main control