refactor serialise