Base of serialization implemented.

File opening and passing the file stream as an argument for serialization added.