Improved directory creation.