set interval inside class definition