Enumerate instead of our own counter

I also removed trailing whitespaces which messed up the code :)
I think that 2 empty lines are used only after class definition.
Function definitions are separated just by one line