This version checks if multiple mains occur