initial code based on https://github.com/phonegap/phonegap-start