added boolean retainAllCaps parameter to prevent words with all uppercase letters from being excluded