Refactored raise clauses to make them more readable.