Generalized some exceptions
Removed some unused imports