Slightly modified due to changes in GUI.