Some documentation and changes to avoid thread contention