Basic refactoring of exceptions problem