Removed unnecessary import
Break serialization out into top-level functions