Revamped the plugin to support Cordova 3.0+