added expandDir method