handle an IndexError on rearrange_* more gracefully and present message to user
remove unused rearrange functions