Re-work of sample code