added some pseudocode, lemmas and figures