add profiling call, centralize configs, simplify has_neighbor