Added outputPath parameter to functions to define output directory