Cleanup unused imports and use volitile in place of atomic boolean