 		
 	dispose: -> @removeAllListeners()
 
-
 	setState: (stateObj) ->
+		# validate state change
+		
 		oldState = @__state
 		@__state = stateObj
 		
 		@removeMethods oldState.methods
 		@addMethods @__state.methods
-		@buildActions @__state.actions
+		@buildTransitions @__state.transitions
 	
 	removeMethods: (methods) ->
 		return unless methods?

			@["_#{method}"] = @[method] if @[method]?
			@[method] = impl
	
	buildActions: (actions) ->
		for action in actions
			destination = @pathResolver action.destination
			chgMethod = @[action.method]
			@[action.method] = =>
				result = chgMethod.apply @, arguments
				@setState = destination unless result is true
	
	changeState: (statePath) ->
		# TODO: suppport absolute and relative pathing
		# does path exist from the current state? 
		# is this the first path?
		unless @__state?

		# change old methods out
		# put new methods in
		
		# wrap actions in decision functions
	@StateChart (chart) ->
		@::__statechart = {} unless @::__statechart?

		addPaths = (statesObj, parent) ->
			for name,defn of statesObj
				@::__statechart[name] =
					name       : name
					transitions: defn.transitions
					methods    : defn.methods
					parent     : parent
			
				# TODO: validate contents for state
			
				addPaths defn.paths

		addPaths paths
		
		# TODO: confirm integrity of chart, makes sure all entry / exit points are accounted for
		
	constructor: (config) ->
		return unless @__statechart?
