Changed indexOf to jquery's inArray