added version byte encoding/decoding