The second part of the "Fun Algorithm"