Slightly more elegant solution for overwriting output files