Shouldn't this be unlocked immediately after the if-block below? Otherwise the storage is locked for potentially minutes.