Cleaned up using pylint and my own eyes