First working version with multiple transactions