Overhaul to entity classes. Introduce base classes