Override prepare query functions

This PR is based off of #6.

It allows both prepareAutoQuery and prepareManualQuery functions to be overridden.