implemented and tested Rearrangements class