refact ws and model