Make category-related code more readable

Change-Id: I73801d23e53eb822421c430d2dd094ce82a9c646