Cleaned up some more the code for loading large queries.