Help with iTunes folder action

I have a folder named “Downloads” where my new mp3 files downloaded from the internet are placed.
I want to add them to a playlist “Downloads” in iTunes which is in playlist folder “1”.
I have attached the following folder action to “Downloads” folder:


property type_list : {"MPG3", "MIDI", "AIFF"}
property extension_list : {"mp3", "mid", "aif", "wav", "m4a", "mp4", "3gp"}
global counter, source_folder, selection_list, these_items
on adding folder items to source_folder after receiving these_items
(*tell application "Finder"
		activate
		try
			set the source_folder to (folder of the front window) as alias
		on error -- no open folder windows
			set the source_folder to path to desktop folder as alias
		end try
		set selection_list to get selection as list
		set these_items to selection_list
	end tell*)
	
	if (count of these_items) is greater than 0 then
		--process items
		set counter to 0
		repeat with i from 1 to (count of items) of these_items
			set this_item to item i of these_items as alias
			set the item_info to info for this_item
			if folder of the item_info is true then
				process_folder(this_item as alias)
			else if (alias of the item_info is false) and ((the file type of the item_info is in the type_list) or the name extension of the item_info is in the extension_list) then
				process_item(this_item as alias)
			end if
		end repeat
		
		--Deletes original selection
		--tell application "Finder" to delete selection_list
		
		display dialog (the counter as string) & " items have been added successfully." buttons {"¥"} default button 1 giving up after 3
	else
		display dialog "No items selected"
	end if
end adding folder items to
-- this sub-routine processes folders
on process_folder(this_folder)
	set these_items to list folder this_folder without invisibles
	repeat with i from 1 to the count of these_items
		set this_itemPath to this_folder & (item i of these_items) as string
		set this_item to this_itemPath as alias
		set the item_info to info for alias this_itemPath
		if folder of the item_info is true then
			process_folder(this_item)
		else if (alias of the item_info is false) and ((the file type of the item_info is in the type_list) or the name extension of the item_info is in the extension_list) then
			process_item(this_item)
		end if
	end repeat
end process_folder

-- this sub-routine processes files
on process_item(this_item)
	tell application "iTunes"
		launch
		add this_item to playlist "Downloads" of source "Library"
	end tell
	set counter to counter + 1
end process_item

Something is wrong in the script. Before I added the code for folder action the script worked on selected items of Finder and it worked properly.
Now, it sometimes does not add any item to the playlist and at other times it adds more than the number of items i want it too (i.e. it adds the items which are already present in the folder and not just the new ones).
Help, please.
update: wait, i may have figured out the problem by commenting out some lines. Now, it seems to work properly. However, please improve the script if you see any mistakes.