fixed some 'potential' race conditions and added some notes