Refactoring trying to fix some logic issues

This is a refactoring to fix some strange/bad logic things in the current cookbook. This refactored version makes using additional features more robuust and clear.

Tested the new code using test-kitchen and some manual tests using the transport feature as target for the tests. Of course more testing is always welcome :smile: