refactor code for minification