Refactor package installation