Refactor and WS