added more message encoding/decoding funcs