replace queue to array
fixed search