complete the algorithm without N-out-of-M relationship. Needs still testing