must return with length=0 if no elements found