Refactoring the countDown function.