Refactor error handling on load.