reformatted webapihost code