Added command script and error handling with json