Added output path as a parameter.