refactor: refine query process