Flatten the conversion function
Add comments to conversion script