Heavy refactort of install procedure