added rearranging of rows