add options for perm p and keep minimum