Revising lock to synchronized method