added the p switch to mkdir so it won't complain if the dir already exists.