Add pseudocode & fix some typos