Renamed the main controller code