Code reformatting - general tidy up