Added query function.