Plot fitting classes contributed by Matthew Wright.