Made this more readable by fixing indentation, removing useless stuff
and adding some notes.