Tidied up sanity test routines.