I would move this to utils as well.  To me, it feels separate from the algorithm behavior.  Thoughts?