added averages, and works on win7 machine