added act() method
implemented act() where index is greater than 1
added test case and fixed memory bug in act()