 		partsLength = parts.length
 
 		#split the tokens into quads of @markov length
-		for i in [0..partsLength - @markov - 1] by 1
+		for i in [0...partsLength - (@markov - 1)] by 1
+
 			quad = new Quad [ parts[i..i+3]... ]
 			@addQuad quad
 

	###
	@markov - the markov order to use for this jsMegaHal instance, defaults to 4
	###
	constructor: (@markov = 4) ->

	###
	generate a number between min and max, inclusive


			#and then get the next tokens
			if i < partsLength - @markov
				nextToken = parts[i+@markov]
				@next[quad.hash()] = [] if not (quad.hash() of @next)
				@next[quad.hash()].push nextToken

