Better use of vars. Check if dir exists first.