Refactored errors into their own module, fixed a test which was wrong.