Modified to handle more than one command.