added update neighbors function