Simplify the use of locks where possible, remove the locking when it is not
required.

Simplify the code a little bit.

Reviewed by:	andrew (previous version)