Change offset to atomic operations, remove write locks in read/write.