improved gui.py