speed up cat_data

by making it less iteratively dependent