Use average function in media function.