Split cleanTransactions in another function