Added Loop function for looping over a command.