improve dirichlet formulation