change queries condition from hash to condition object, adding timescope, move queries to models