Adding intermediate map
Fixed bug with calculations