Code cleanup
Updated isStopping to be thread safe