minify logic complete