Code upgrade.

Added readonly keywords for fields, changed mutexes for synchronization
objects.