change function to generate loop label