public static int term(){
		// Start of the term is the current last state
		int start = state;
		// Increment state to make space for a branching machine
		state++;
		// Terms are a literal
		int fact = literal();
		// If we have run off the end or finished the term
		if(isLiteral()||j>=expression.length()){
			// Then clean up the branching state and return
			return setState(start, -2, fact, fact);
		}
		// Grab the next character
		char c = expression.charAt(j);
		// If it's closure
		if(c == '*'){
			// Consume the *
			j++; 
			// Branch to either the factor or continue on
			setState(start, -2, fact, state);
			// Factor points to itself so it can be repeated or can move onto state
			setState(state-1, (char)fsm.ch[state-1], fact, state);
			return start;
		}
		// If it's +
		if(c == '+'){
			// Consume +
			j++; 
			// Don't need to branch just point to the factor
			setState(start, -2, fact, fact);
			// Make state to loop back to the start or continue on
			setState(state-1, (char)fsm.ch[state-1], start, state);
			return start;
		}
		// If it's ?
		if(c == '?'){
			// Consume ?
			j++;
			// Branch to the factor of skip past the factor
			setState(start, -2, fact, state);
			return start;
		}
		// If it's Or
		if(c == '|'){
			// Consume |
			j++;
			// | Is followed by a term
			int term = term();
			// Make a branch to the factor and the term
			setState(start, -2, fact, term);
			// Update the state that points to the or
			setState(term-1, (char)fsm.ch[term-1], state, state);
			return start;
		}
		else 
			// Else just tidy up the branching machine to point only to factor
			return setState(start, -2, fact, fact);
	}