moved some unshared code out of ExpressionBuilder