error handling cleaned up and focused on http status codes