Added functionality for rearranging rows.