finished implementing custom serialisation