corrected neighborhood function in position class