Added better exception handling
Refactoring and introducing BaseController