added serialization to Main.java