Refactor group views by moving logic into the model