JSON serialization to file and better VM structure

Added helper methods for serializing to and from JSON. Also added helper methods for reading and writing text to files. Modularized view models for later reuse.