move kmin to subpackage