Refactor ConnectCommand and MessageCommand. Need to speed up.