Exceptions refactoring