Exception Handling and a bit of cleanup