Removed dependency of array.indexOf function.