Improve GUI code