Now using request.json.
Some code cleanup.