Reset subtracted to false to handle repeats after subtraction
Get rid of that inner if