Fixing malformed dict.
Fixing logging and pep8 errors.