rough draft of directory creation, and fixed a bug