update algorithm

Still need to test the query and the results

Guessing because the remaining docs are too small