Commenting code

Hopefully with some helpful comments.