fix functions names; fix indexOf condition