updting chart script and added average logging