add functions.py and iap_sim.py