Improve category handling