Fixed bug in pseudo code.