Refactor entity classes