Tidied up testing framework and sample tests