Converted server responses to JSON. Generalized client-side functions.