Update two dimension search algorithm