Smarter management of ware plugins loading and unloading

* added mecanism for loading wares only when necessary
* cleaned code