Siwtched to json API, fixed URI encoding, made better