refactore entities