Removed unused method.
Add null check for locked threads.
Removed unnecessary goto statement since inner loop is now gone.