Added an algorithm to help understand bad code.