Updated to use phonegap library