move final zams calculation into its own function