Added debugging switch: -d