SERIALIZER: add functions for serialization to file