REST in web page works now, but improvement needed