Add updateRemainingTime function