tidying up and fixing tests