a second solution that uses asynchonous callbacks for timing instead of a central setInterval timer