Cleaned up the UI code