Updated age category function