initial run command and some refactoring for cordova