First go at separating the serialization code to be able to add serpent later. (.net)