update to use setInterval and no recursion