Tidying up testing code