changed indexOfBadString to static method