more specific average function