Adding the pseudo code