Tidied main controller