Optimize code and fix install on step 5