Fixes #58
Fixes #56
Added stats package tests.