[fix] bug in group system when same group code exists over multiple years
[fix] bug with joining template groups
[fix] formatting
[fix] minor bug fixes