added encoding/decoding of several message types