adding JSON serialization instead of Java serialization
Stores data as JSON
cleaned up code