Small refactor to private method for handling lookup query.