General tidying and formatting