modified demo function