Moved directory creation into defs, added some useful funcs.