now using "group_by" to make the code prettier