code for GUI