refreshed sample code