setting up better JSON encoding