refactor updating location change logic.