made it idempotent. removes output file if it already exists