James C - pulled a bunch of vars out of case class params
James C - nuked while loops
James C - misc privatizing, adding recursion variants