adding minkey maxkey support