     return res
   }
   
-  /// Compile expression `expr` in environment `env`. Parameter `tail` specifies if `expr`
-  /// is located in a tail position. This allows compile to generate code with tail calls.
-  public func expand(_ expr: Expr, in env: Env) throws -> Expr {
+  /// Expand expression `expr` in environment `env`.
+  private func expand(_ expr: Expr, in env: Env) throws -> Expr? {
     switch expr {
       case .pair(.symbol(let sym), let cdr):
         let cp = self.checkpointer.checkpoint()
         switch self.lookupLocalValueOf(sym, in: env) {
           case .success:
-            return expr
+            return nil
           case .globalLookupRequired(let lexicalSym, let environment):
             if let value = self.checkpointer.fromGlobalEnv(cp) ??
                            value(of: lexicalSym, in: environment) {

            return expanded
        }
      default:
        return expr
    }
  }
  

    var next = expr
    var exprs = Exprs()
    while case .pair(let car, let cdr) = next {
      if localDefine {
        try self.expand(car, in: env, into: &exprs)
      } else {
        exprs.append(car)
      }
      next = cdr
    }
    // Throw error if the sequence is not a proper list
