Added define for turning threads on/off