Use returns rather than if/else for error blocks