Modified some procedures for GUI.