Moving checkExpression into its own function.