add json reporting, fix turn logic.