Added encoding/decoding for peer messages