Switching groups

Function for switching groups but it should be looked over. If it is correct it can be used to switch in between groups using keyboard shortcuts. I'm looking up things on that now