Extract the transaction code into a separate model and calculator