more query logics implemented