Refactored code to make classes less dependent on each other and easier to unit test
Added unit tests for transactions