Updated code to support Phonegap Build