modified main controller