Wrote multiplicity function.  Now everything is finished, but still have to test and debug.