use atomic variable to provide thread safety
Add simpleformatter, refactor