added counting up and counting down fuctionality