Added support for --mode json-file, removed all unwraps, added better error handling
#18
+170
−54