Updated plugin to work with cordova 3+