GUI code fix and clean