SPOE search fixed

The SPOE search was giving wrong results. Reworked the algorithm.