#4: Added small improvement that shows the error message if the registration is not successful