some edits, also put the pseudocode back in