Many minor fixes, including related to PEP8 and readability. Additionally `localhost` vs `127.0.0.1` had issues in the config, so I had to include the latter.