added negative flag for subtraction