Atomic optimization

Discussed in PR #60.