As far as I can tell, you're introducing a bug by removing this line. As it is computed on line 564, `cos_in` is multiplied by the length of `incoming`, and this factor needs to be cancelled out here.