Convergence and refinement of the Wang-Landau algorithm