Honestly, I haven't tried very hard to understand the algorithm.