Refactored targetDir usage to allow resource specific output paths.