tidy up sample code