add check for hostname validity to ensure type prefixes only being created if there is a valid hostname to extract it from