Fix markup.
Tidy up docs.
Weight centroid calculation by the density. Relates #775.