refactor path and query