Add support for groups, see #1. Front end still needs to be done