Adding a neighbor rate function