heavy cleanup of simply typed lambda calculus