added appinventor code, reorganized