converter script I modified to fit my needs