It is very confusing that at the end of runPeerMode and runStandbyMode is all of this setup for the other mode. It needs to be pulled out or organized in a different way.