Changed to use $index instead of calling indexOf