added code for collapse rows