Added adptive gain