Help RFID-RC522

Hi guys ,
I’m trying to change the default key RFID-522 device, I entontrado within the libs this example (attached).
With this example I managed to change the password, but do not really understand the program code, someone could help simplify the program for that alone can change the password.
A key 1.Mostrar used.
A key 2.Autentificar
3.Mostrar key B used.
4.Autentificar key B.

Or if there is another way to change the default password of these cards in order to provide them with more security.

Change_Key.txt (11.5 KB)