GUI main code