Update and refactor the conversion script.