Defensive programming sample code