changing lock(this) to use a lock object