refactored the Entity model