Further work on serialisation functions.