Pared down and cleaned up sample code