replaced stiff age categories by dynamic algorithm