Added deubg support.  Also added an optional parameter to set a hostname