Move queryset outside global scope.

Change-Id: I9c1a2611679c5a2b1185c0e02af1ec8de509bd87