Added #ifdef several places