can't we use slice and indexOf instead ? Remember that this might be called thousand times at startup...