With lock timeout

It looks alright to me, except those else-s on next line (is that it? ) fixed in commit 'formatting'