Dan's pythonic improvement to aggregate detection