Refactored to allow seralizing to any io.Writer

Not just to a file by name. Same goes for deserializing, now
it can be from any io.Reader