atom: debug mode, refactoring