adding host group id building function
simplified case handling