Add meanweight functions and an example using them