Improved directory handling and naming.