adding mm() function leveraging ldir()