adding category logic