Refactor method to load queries