done generate ref queries