peer handling logic