First attempt at cleaning up source.

@nesquena @databyte Review pls?

You might want to view the diff with `&w=0` appended, since I changed some indentation.