re-arrange server request handling ready for html form