Use pythonic Exceptions where possible, less if nesting, general cleanup