averages and basic quering capabilites
factor out functions in different namespaces for clarity