Fixed pseudo code