add age processing, and move save code to separate file