Pseudo code updated