refactored the base controller class