Improved the code and changed the behavior and done some tests (and bugs
fixed)

 - Only managed hosts are taken into account