Reworked Controller class for ajax