Some cleanup

I have cleaned up the code a bit and fixed some typos. 

Nothing fancy.
Looks good, a lot easier to understand compared to the loopy solution with temp variable :)