first two helper scripts for data conversion