Various changes to mesh code.