Moved code creating temp folders into make_temp function.