return pair instead of iterator