Clean up the error types
Big refactor