changed the execute_command to accept either command index or command name