removed unnecessary $dir variable