cleanup unused vars. changed platform #ifdefs a bit.