WIP on groups + code cleanup