Refactor work of the webservice