Updated send_command function