refactor install/setup logic