Refactoring; less try more if