improving it by passing the host as a parameter