add toggle for raw source
add avg aggregation and support for writing custom aggregators