modified convert.c