Added data serialisation functions