proper setInterval function