private int solveStack(int nextRank) throws InvalidEquationException {
		//Create variables for the current section of equation
		NumericalExpression e2 = null;
		NumericalExpression e1 = null;
		OperatorExpression op = null;

		try{
			//Pop the first numerical expression off stack (rhs)
			e2 = (NumericalExpression)expStack.pop();

			//Pop the operatorExpression off the stack
			op = (OperatorExpression)expStack.pop();

			//Pop the second numrical expression off stack
			e1 = (NumericalExpression)expStack.pop();
		}
		catch(ClassCastException cCE){
			//If any one of these expressons is not what we expect, this is an invalid equation
			throw new InvalidEquationException();
		}
		catch(EmptyStackException eSE){
			//If any one of these expressions isn't there, this is an invalid equation.
			throw new InvalidEquationException();
		}



		//Set operator expressions
		op.setE1(e1);
		op.setE2(e2);

		//Evaluate the operator
		double result = op.evaluate();

		//Store the new lastRAnk or 0 if there is not one
		int lastRank = expStack.size() > 0 ? expStack.get(expStack.size() - 1).getRank() : 0;

		//Store the result as a numericExpression on the stack
		expStack.push(new NumericalExpression(result));

		//If the new lastRank is still greater or equal to the nextRank we must continue solving and then return the result
		if(expStack.size() > 1 || lastRank > nextRank)
			return solveStack(nextRank);
		else
			return lastRank;
	}