Found error in 4 neighbor case to be missing () causing pointer to be subtracted in arithmetic expresiion. Found error in 8 neighbor case to not be an error so much as an interesting side effect of how having diagonals with weight 1 makes some heuristics cause very wierd behavior. I believe it works now.