1st draft of the algorithm pt1 post.