got the algorithm written out, slowly debugging
algorithm works, needs some tuning
tuned algorithm to take into account court fillage