refactor host rewrite a bit