Moved tryLock to inner method