refactoring: Repository replaced with Query object, namespaces clean-up