Refactor entity