added self.startState and self.endState

self.startState and self.endState are initialized to tuples of length
(order), representing the start and end states of a sequence
fixed getNextNode() crashing at end of sequence
stop getSequence() breaking if can't find an END
added addNextNode() function