Better each with index implementation

I changed the current eachWithIndex implementation from using a inner variable (var i = 0; i++) to the enumerate function.