Another related (but not good) algorithm FTW :) ... tests coming soon.