Refactoring to avoid code duplication and make it easier to add more taxonomies in the future.