adding in first attempt at self-thinning algorithm.