Separated QueryLine into its own function