Added done flag to ISR and while loop