implemented msg creation and serialisation funcs