Update countdown function so it does not define any global variables or define any new variables