Do not use for(;;)
KNF.
Remove unused code.
Use same #ifdef style everywhere.