improved Sec.pm's function