adjusted the age algorithm