added test coverage. modified extensions to remove direct dependency on query source. general refactoring and reorg.