Changed directory creation to be recursive