Updated to use json and structs for transferring data.