Refactored errors into their own class