Done implementing Query func