refactor style group detection