Refactor install script.