added indexOf second part of function