Generating big ol query in a much cleaner way