refactor hostmanager