Improved algorithm for more decimal places
Commented debug code