Refactor for better handling of local peer detection.