adding changes to peer factory and handling additional messages