more js cleanup and abstraction for groups