Fixing imports.
Using own exception type.
Using own exception type.
Raising correct exception class.
Using own exception class.
Removing legacy code.