Basic implementation of Session.average.

Pretty much directly taken from the old jjtimer sources.
Also switch to single quotes in several places.