Refactor how groups are applied and how multiple instances of the same job are handled