Changed the way file naming is done, so that things can be a bit more general.