this is the code for threeSim, an iOS app available on iTunes