Stat functions finished, ready for testing.