edited so that groups within each layer also contains info about students