I find the idea of returning a "command" string to be very strange. Why doesn't this function just call the appropriate other functions to do the proper work, rather than returning a "command" for some other function to parse?