Clean up exceptions and do PEP8 stuff.