Added checks to see if sub directories exist