updated with live code from demo