Added a few comments inline (feel free to use/discard).