changed doc for optimizeXGUI.m and cleaned up code