Sparky: refactor #ifdef based on review feedback