separate updates to W and H and improve tests