changing to support new SQL format