public String eval(final String messageTemplate, final Object problem)
	{
		try
		{
			final StringBuilder results = new StringBuilder(
					messageTemplate.length());

			int state = STATE_OUT_OF_EXPRESSION;
			int expStartIndex = 0;

			/*
			 * So you may have guessed that writing compilers is not my strong
			 * suit. Okay so this isn't exactly the fastest or most attractive
			 * code in the world, but it solved the problem in a hurry and
			 * didn't require much of a state machine. If you think my code
			 * sucks, at least I got it working in 30 minutes. If you think you
			 * can do better please send me a patch.
			 */
			for (int i = 0, length = messageTemplate.length(); i < length; ++i)
			{
				final char current = messageTemplate.charAt(i);
				char nextChar = 0x0000;

				if (i + 1 < length)
				{
					nextChar = messageTemplate.charAt(i + 1);
				}

				switch (state)
				{
					case STATE_IN_EXPRESSION:
						if (nextChar == '}')
						{
							final String found = messageTemplate.substring(
									expStartIndex, ++i);

							final Object result = evaluate(problem, found);

							results.append(result);
							state = STATE_OUT_OF_EXPRESSION;
						}

						break;
					default:
						// Start expression
						if (current == '$' && nextChar == '{')
						{
							// skip $ and {
							++i;
							expStartIndex = ++i;
							state = STATE_IN_EXPRESSION;
						}
						else
						{
							results.append(current);
						}

						break;
				}
			}

			/*
			 * append the entire escape just incase they left it open, so
			 * ${problem.value gets printed in the results if there is no
			 * closing brace;
			 */
			if (state == STATE_IN_EXPRESSION)
			{
				final String openExpression = messageTemplate.substring(
						expStartIndex - 2, messageTemplate.length());

				throw new InterpolationException(openExpression);
			}

			return results.toString();
		}
		catch (final Throwable t)
		{
			throw new InterpolationException(t);
		}
	}