Added countdown function and checked if the loop was working