Refactored function

Refactored function containsString