Update the ws fucntion.