Simplest atomic version of code (one thread)