Updated authenticate method