Help debugging Mail action script

Hello. I have written a small script that I plan to run as a Mail action against iTunes Store receipts. The script will extract the order total from the receipt and automatically enter a journal entry in Liquid Ledger. Below is a modified test excerpt of some code which runs very slowly.

The conversion of the email content to string and then to quoted form seems to be what is slowing it down. Does anybody know why? When I monitor the CPU in activity monitor while the script runs there is little to no activity.

tell application "Mail"
	set theMessages to get selected messages of message viewer 1
	repeat with theMessage in theMessages
		set orderTotalString to do shell script "echo " & quoted form of ((content of theMessage) as string) & "| grep -m 1 -e 'Order Total'"
		set orderTotal to word 4 of orderTotalString
	end repeat
end tell

Model: 15" PowerBook G4 (Sept. 2003)
AppleScript: 1.10.7
Browser: Safari 522.11
Operating System: Mac OS X (10.4)