Tightening up code inside atomic block, and whitespace changes (tabs to spaces)