move to groups js function