moved directory checker to funcs.js