Some cleaning up.
Expanded the 'save transaction' routine and cleaned it up. Still some work to do though.