code review changes
Merge pull request #1509 from john-hill/entity-query

code review changes