Rewrite logic classes

Make changes in "groups" table