made a glorious change to the for-loop based on Xiaohu's recommendation