adding timescope, massive query refactoring finished