Use serialization submodule, refactoring