added some aggregate functions