rearranging and also fixing a bug that the transactions log created