ajax_demo: modified code to follow guidelines, see discussion