Refactor of serialization utilities