Added stats calculation. Relates to #100.