Improve GUI code and remove old code.