some corrections. Now output of 2 approaches seems to coincide. More verification needed