Added Groups. Also small refactoring.