add error checking to validate whether passed in group exists in config, and change logic for looping of commands