added ws_parity function