Added stuff; realised that the gathering step needs to be more sophisticated and the whole process needs some kd trees.