Entity refactor