(refactor) Refactored error-handling to work with automatic 404s and tests.