Enumerate instead of our own counter

I also removed trailing whitespaces which messed up the code :)