adding support for minkey and maxkey

Adding support for minkey and maxkey