added enumerate to a loop