adding legitimate way of parsing json
cleaning up code