Refactor install process