Use contains() instead of indexOf()
Replaced more instances of indexOf with contains