I think this seems fine to me. Would it not be easier to just pass a list to `rearrange` to begin with?