Rewriting toad averaging script.