move hosts function to .functions file