Refactor install script