added gain analysis