Modified code to use getPeerByName.