code extracted into separate setInterval