mercury.py codestyle improved