Creates rearrange() function to streamline common array management scenarios