add convert and loop function