Tidy up of the sample code