Refactoring error handling

* Removed complexity of extra variable to track status