Mistake in 2480b55f21. Also deduplicate some of the code to find the indices of mesh elements.
2480b55f21