Added output directory support