created the cell proximity match algorithm