Reorder and cleanup functions.
Rename utils module to statshelpers.