Updated conversion code