Fixed minor bug on function to compute weight W. Added unit test for the function.