optimization by beta reduction