Algorithm is figured out. The code is pretty trashy right now.
Merge remote-tracking branch 'origin/master'