Cleanup and improvements for transaction api.