updated with sql