Adapted tests, and implemented length checking for reorder_keys.