Photoshop save as jpg issue

I saw this sample and I am trying to get it to work for my purpose.
I have written this script to loop thru folders and pull out images that are resting in certain folders. I then open the images in PS, apply some actions to them and then I would like to save them in a specific spot as jpgs at full quaility with a filename of the orig folder name. Everything works except the part of saving it as a specific name. I just saves it at the name of the psd and copies over itself on each pass thru the loop. I know I am getting the correct text from the folder because i set the current layer to the same text.
Thanks for any help,

Here is my code:

property dLetter : " "
property saveLoc : "Mac Work:Ryan:src:Image Croping:src_JPG:"
tell application "Finder"
	set theFolder to (choose folder with prompt "Choose the folder where your images are stored.") as alias
	set all_Subs to count of every item of folder theFolder
	display dialog "Enter the Letter" default answer dLetter
	set theLetter to the text returned of the result as text
	repeat with i from 1 to all_Subs
		if kind of item i of theFolder is "Folder" then
				set theFolderName to name of item i of folder theFolder as text
				set theSubFolder to (theFolderName & ":canon") as text
				set all_items to count of every item of folder theSubFolder of folder theFolder
				repeat with j from 1 to all_items
					if kind of item j of folder theSubFolder of folder theFolder is "JPEG Image" then
						set theImage to name of item j of folder theSubFolder in theFolder
						set theLoc to ("Mac Work:Ryan:src:images:" & theLetter & ":" & theFolderName & ":canon:" & theImage) as text
							tell application "Adobe Photoshop CS"
								open alias theLoc
								do action "Add Me" from "ryan's"
								do action "src to Canvas" from "ryan's"
								do action "SM sharpen" from "ryan's"
								set name of current layer in current document to theFolderName
								save document 1 in ((((saveLoc) as string) & theFolderName & ".jpg") as file specification) as JPEG with options {class:JPEG save options, quality:12} with copying
							end tell
						on error
							my writeMIA(theFolderName)
						end try
					end if
				end repeat
			on error
			end try
		end if
	end repeat
end tell

on writeMIA(theFolderName)
	set theTxt to theFolderName & "    " as text
	set thePath to ":Volumes:Mac Work:Ryan:src:"
	set theFile to (thePath & "mia.txt") as string
	set fileRef to (theFile) as alias
	set fileRef to (open for access theFile with write permission)
	set theEnd to (get eof of fileRef)
	set eof of fileRef to theEnd
	write theTxt starting at theEnd to fileRef
	close access fileRef
end writeMIA