Refactored stuff; ensuring root directory exists.