move fillCategory into its own function