refactor js countdown