Optimize the sample code of HelloIAP.