added config and debug version of script