Deprecations and PEP8 fixes