updated ws code