Append package only once
Add remove package from the list of packages as needed
Fixing various issues related to package dependencies