part 2 of previous commit + bugfix in gui.py.