updated to remove plainsql