Implementing binary serialization
Added serialization to main class
Binary serialization now works and should be compatible with the Java version.