Added functioning update_gains