Finally done with the algorithm for server selection. Testing ensues after I bake myself some apples.