changing defines calculations for clarity/maintainability