Now checks if names contains a string and throws an error otherwise