F/optional package management

* Implements `$manage_package` class option
* Fixes unit tests
* minor other stuff