Added setInterval method to set a defined interval