added a debug argument to script execution and corresponding functionality to cater for it -DS