Basically changed around the AQP class for faster group by queries