introduce transaction logging, some reformattings