added support for subdirectories. subdirectory for files can be set in config