Made minor changes to queries