Add variable to get removed row index
Fix bugs with deleting and adding rows to table at right places