Improve average calculation + profile xml