added groups and fixed a small bug