device grouping routine