start of separation of GUI code to avoid duplication