implemented sum, avg. Found a way around the ugly cast hack. Must have been blind, yesterday.