started controller and main function