Implemented saving and loading to and from json.