added aggregates to the functions