Merge Daniels's code to the phonegap project