documented the algorithms a bit