cleaned out unused code, added some more comments.
no functional changes.