Code for 1d version of WIM