Main controller