added in code to distinguish between row selection in cat and in name