Added pin authentication failure disposition and cleaned up some code