changed to get custom data with sql rather than api