implemented average operation (#25)