updates to gain_calc for testing