improve a lot of minor details as:

* dealing with core packages
* category handling
* keeping existing variables