update to use query