Separate publishing and querying implementation into modules
Added query tests.

And support for funnel steps.