Make _remaining volatile since it's used in interrupts
Tidying up