completed implementation of neighborhood estimation