Correct error in Error handling
Start refactoring code