Remove an old line, not needed anymore.
Split some shared menucode to a external function.
Some code cleanups to pass flake8, it doesn't like my globas, tought.