Reorganize Functions and Command, modify frmMain.