refactor of commonqueries