Added support for mesh refinement (exposes bugs)