a GUI version of the same code