Some cleanup

I have cleaned up the code a bit and fixed some typos. 

Nothing fancy.