Babystep refactoring of versionqueryexecutor. Fixes failing endtoend test.