refactor entity