Tidying and fixes