Made debug mode controllable via '-d' option.