the value of formatter was lost. i was originally under the impression that formatter would be maintained in the scope but its reset in the loop.