changed procedure for cubic equations