Ordered exceptions. Removed unused imports etc.