cleaned up the sample code a touch