ws refactoring