Added indexOf method and test cases