made hostname matching better, and removed grep