Next step following other suggestions

1) changing AtomicBoolean to volatile boolean

2) using getAndSet as much as possible

3) using << 1 instead of * 2

4) fix wrong style from previous commit