faster calculation version