Added pseudo code 1, 5, 6