Enumerate instead of our own counter

I also removed trailing whitespaces which messed up the code :)
The point of this line is to have 2 empty lines between function definitions. I can live with this for now, since it's such a small change.

Thanks!