Fix: initialize "attempts" to 0 to ensure proper counting of attempts.