implemented a version that works for odd numbers of shareholders