Use 'changed' variable for if statement