Added debug mode for timing/logging, flag -d