added binary searching to wed