improved render function on demo page
moved logging statements to debug function