cleanup and improvement of the user agent and json parser mws