When there are several charges against any person, or persons, for the same act or transaction, or for two or more acts or transactions connected together, or for two or more acts or transactions of the same class of crimes or offenses, which may be properly joined, instead of having several indictments or informations the whole may be joined in one indictment, or information, in separate counts; and, if two or more indictments are found, or two or more informations filed, in such cases, the court may order such indictments or informations to be consolidated.