allow for arbitraty number of sources and sinks