extract aggregate functionality