Remove unnecessary lambdas and imports.