adding minKey and maxKey