general tidy and improvements