refactor for json webservice output