 			directive.candidateKeys ?= []
 			directive.candidateKeys.unshift 'id'
 			
-			candidateHooksInvoked = {}
-			
 			currentSkinKey = null
 			defaultSkinKey = config.get 'packageConfig:shrub-skin:default'
 			
 			# Proxy link function to add our own directive retrieval and
 			# compilation step.
 			link = directive.link
-			directive.link = (scope, element, attrs, controller) ->
-				
+			directive.link = (scope, element, attr, controller) ->
+				
+				candidateHooksInvoked = {}
+			
 				# Save top-level arguments for later calls to link functions.
 				topLevelArgs = arguments
 				
 				# Current template candidate.
-				candidate = null
+				candidate = undefined
 				
 				recalculateCandidate = ->
 				

					# interpolate candidate keys, and falling back to
					# attribute values, if any. Candidate arrays are
					# joined by single dashes.
					candidateList = do (scope, attrs) ->
						list = []
						
						for keys in directive.candidateKeys

					
				applySkin = (skinKey) ->
					currentSkinKey = skinKey
					recalculateCandidate()
				
				applySkin defaultSkinKey
					
				# Relink again every time the skin changes.
				$rootScope.$on 'shrub-skin.changed', (event, skinKey) ->
					candidateHooksInvoked = {}
					applySkin skinKey
					
				# Set watches for all candidate-related values.
