handle an IndexError on rearrange_* more gracefully and present message to user
remove unused rearrange functions
Merge pull request #2072 from dimagi/rearrange-index-error

handle an IndexError on rearrange_* more gracefully and present message to user