New algorithm for constructor taking a formula