cleaned up gui code