added average function to 1_4