documented Atomics; added main thread function; other changes