Some minor modifications to the logic and more cleanup.
Some minor modifications to the logic and more cleanup.

Signed-off-by: Erik de Bruin <c195b508e6f0c57aeafdb5e96947e2b79e6a4b40@ixsoftware.nl>

adufilie/flex-falcon,adufilie/flex-falcon,greg-dove/flex-falcon,greg-dove/flex-falcon,greg-dove/flex-falcon,adufilie/flex-falcon,adufilie/flex-falcon,greg-dove/flex-falcon