Fix bad math, remove duplicate macro definitions.