Added several enhancements

Added configuration file, error checking for calls to the cordova CLI,
support for debug mode (-d) and cleaned up the code a bit.