Fixed redundant additions and subtractions