Continuing refactoring and added exceptions