add a central testing function, minor changes to all testing functions to avoid recursive calls