refactored to not use entity groups anymore (for better scalability)