added functionality to deal with multiple motifs