var name change
break format loop out to a function