Added statistics gathering.