Added time counter to check the calculation speed