function to send cmds