Major refactoring -- atoms test all passing