getting proper index therefore state