Improve package installation code