created logic for activity index