minor refactoring
minor: support 1 or 2 args
replace d_type for compatibility with other filesystems