support for variable number of control groups

Previously, the water command only supported the control
of one group.  It has now been generalized to support
any number of control groups.