updated demo function