updated with better ifdefs that work