[Olena-patches] 1123: Add mesh and factor some code.