revamped mkdir() with working scoping functionality