Refactoring, updated di container. Misc fixes. Moving to refactor query class