Cleaned up the sample code