Added in more declarative error handling