created index for transactions. some small refactoring.