moved WS to mat_utils