optimize += and -= using ternary operations