started to restructure code, but along the way spending some time figuring out how to document it