modularizing into separate packages
refactoring query issuing logic
so that it can be reused in the handler and the query listener