Fixed transactions and added logging.