Revamped SonicFlow search algorithm

It may or may not still need some work.