refactored the js to use File and Directory items differently.