Now using requestanimationframe function