Fixed logging, use _asdict from simplejson and cleanup.