refactored Entity to be a typed class instead of using inheritance