neighbor calculation was completely broken

manually moving fixes over from my branch, hopefully nothing breaks