Entity groups and refactor