updated with correct queries