Switched from constructors to functions in serialization code

On my machine, the write benchmark was reduced from ~8 seconds to 5.5. Now writing actually outperforms reading (currently 7.5s for me).