finished implementation of statistics